package com.example.sofa_module;

import com.alibaba.android.arouter.launcher.ARouter;
import com.example.common.databus.LiveDataBus;
import com.example.common.mvvm.BaseEntity;
import com.example.common.mvvm.viewmodel.BaseViewModel;
import com.example.common.providerservice.CheckLoginApi;

import java.util.List;

import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

public class TabViewModel extends BaseViewModel<TabRepository> {
    LiveDataBus<List<SofaFeedEntity.DataBean.VideoData>> list=new LiveDataBus<>();
    @Override
    public void onResult(BaseEntity entity) {
        if (entity instanceof SofaFeedEntity){
            SofaFeedEntity feedEntity= (SofaFeedEntity) entity;
            List<SofaFeedEntity.DataBean.VideoData> data = feedEntity.data.data;
            list.postValue(data);
        }
    }

    @Override
    protected void initData() {
        repository.requestData()
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(this);

    }
}
